package SpringFramework.Bean初始化和销毁.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import SpringFramework.Bean初始化和销毁.service.BeanWayService;
import SpringFramework.Bean初始化和销毁.service.JSR250WayService;

// @Configuration声明当前类是一个配置类
@Configuration
// 使用@ComponentScan，自动扫描包名下所有使用@Component、@Service、@Repository和@Controller的类，并注册为Bean。
@ComponentScan("zzz.example.Spring.Bean初始化和销毁")
public class JavaConfig {
	@Bean(initMethod="init",destroyMethod="destroy")
	public BeanWayService beanWayService() {
		return new BeanWayService();
	}


	@Bean
	public JSR250WayService jsr250WayService() {
		return new JSR250WayService();
	}
}
